<?php defined('APP_PATH') or exit('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>友链列表</title>
<link rel="stylesheet" type="text/css" href="vonuo/static/css/vonuo.css">
<script type="text/javascript" src="vonuo/static/js/jquery.min.js"></script>
<script type="text/javascript" src="vonuo/static/js/tablecolor.js"></script>
<script type="text/javascript">
function pldel(){
	var i = 0;
	$("input[name='id[]']").each(function(){
		if($(this).attr('checked')){
			i++;
		}
	});
	if(i == 0){
		alert('请选择要删除的编号');
		return false;
	}
	if(confirm('确定批量删除？')){
		$('form').attr('action','<?php echo spUrl('link','pldel');?>').submit();
	}else{
		return false;
	}
}
</script>
</head>

<body>
<div class="gs_wraper gs_p_l0">
	<div class="title">
		<a href="javascript:;" class="hover">友链列表</a>
		<a href="<?php echo spUrl('link','add');?>">添加友链</a>
	</div>
	<div class="tab_box">
		<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="common_table">
			<tr>
				<th width="70"><input type="checkbox" onclick="$('.all_check').attr('checked',$(this).attr('checked'))" class="all_check" /><label>编号</label></th>
				<th width="120">名称</th>
				<th width="170">网址</th>
				<th width="70">LOGO</th>
				<th width="70">排序</th>
				<th width="100">时间</th>
				<th width="100">管理</th>
			</tr>
			<form action="" method="post">
			<?php foreach($link as $row){?>
			<tr>
				<td><input name="id[]" type="checkbox" value="<?php echo $row['id'];?>" class="all_check" /><label><?php echo $row['id'];?></label></td>
				<td><a href="<?php echo $row['url'];?>" target="_blank" title="<?php echo $row['info'];?>"><?php echo $row['name'];?></a></td><td><?php echo $row['url'];?></td><td><?php if(!empty($row['logo'])){?><a href="<?php echo $row['logo'];?>" target="_blank">查看</a><?php }else{?>暂无<?php }?></td>
				<td><input name="odnum[]" type="text" class="blue_input input_w_40" value="<?php echo $row['odnum'];?>"/></td>
				<td><?php echo date('Y-m-d H:i:s', $row['time']);?></td><input name="idrow[]" value="<?php echo $row['id'];?>" type="hidden" />
				<td><a href="<?php echo spUrl('link','upd',array('id'=>$row['id']));?>">[编辑]</a><a href="<?php echo spUrl('link','del',array('id'=>$row['id']));?>" onclick="return confirm('确定删除？');">[删除]</a></td>
			</tr>
			<?php }?>
			</form>
			<tr class="bottom">
				<td colspan="2" align="left" valign="middle">
					<a href="javascript:;" onclick="return pldel();" class="btn_wei f_left">批量删除</a>
					<a href="javascript:;" onclick="$('form').attr('action','<?php echo spUrl('link','updod');?>').submit()" class="btn_wei f_left">更新排序</a>
				</td>
				<td colspan="5" align="right" valign="middle">
				<?php if($pager){?>
					<a href="javascript:;" onclick="location.href=('<?php echo spUrl('link','lis');?>&page='+(document.getElementById('gopage').value > <?php echo $pager['total_page'];?> ? <?php echo $pager['total_page'];?> : document.getElementById('gopage').value))" class="btn_jump f_right m_t_3">跳转</a>
					<span class="txt_color">每页<?php echo $pager['page_size'];?>条/共<?php echo $pager['total_count'];?>条记录</span>
					<span class="txt_color">当前<?php echo $pager['current_page'];?>/<?php echo $pager['total_page'];?>页</span>
					<?php if($pager['current_page']!=$pager['first_page']){?><a href="<?php echo spUrl('link','lis',array('page'=>$pager['first_page']));?>">首页</a><?php }else{?><a href="javascript:;">首页</a><?php }?>
					<a href="<?php echo spUrl('link','lis',array('page'=>$pager['prev_page']));?>">上一页</a><a href="<?php echo spUrl('link','lis',array('page'=>$pager['next_page']));?>">下一页</a>
					<?php if($pager['current_page']!=$pager['last_page']){?><a href="<?php echo spUrl('link','lis',array('page'=>$pager['last_page']));?>">末页</a><?php }else{?><a href="javascript:;">末页</a><?php }?>
					<label>第</label><input type="text" class="page_input" id="gopage" size="3" value="<?php echo $pager['current_page'];?>" /><label>页</label>
				<?php }?>
				</td>
			</tr>
  		</table>
	</div>
</div>
</body>
</html>